package com.hnhp.controller;


import com.hnhp.model.CatModelQuery;

import com.hnhp.model.Catmodel;
import com.hnhp.service.CatModelService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/catmodel")
@CrossOrigin
public class CatModelController {

    //引入service
    @Autowired
    private CatModelService service;

    @GetMapping
    public List<Catmodel> select(CatModelQuery query){
        List<Catmodel> categoryList = service.select(query);
        return categoryList;
    }
    @PostMapping
    public Integer insert(@RequestBody Catmodel catmodel){
        return service.insert(catmodel);
    }
    @PutMapping
    public Integer update(@RequestBody Catmodel catmodel){
        return service.update(catmodel);
    }
    // 软删除
    @DeleteMapping
    public Integer delete(Integer id){
        return service.delete(id);
    }
}
